import request from '@/utils/request'

export function page(data) {
  return request({
    url: `/node/page`,
    method: 'post',
    data
  })
}


export function saveNode(data) {
  return request({
    url: `/node/saveNode`,
    method: 'post',
    data
  })
}

export function getById(id) {
  return request({
    url: '/node/getById/' + id,
    method: 'get'
  })
}

export function deleteNode(id) {
  return request({
    url: '/node/delete/' + id,
    method: 'delete'
  })
}

export function getAllNotHasCerNodes() {
  return request({
    url: '/node/getAllNotHasCerNodes',
    method: 'get'
  })
}

export function checkNodeHasPrefix(prefixId,nodeId) {
  return request({
    url: `/node/checkNodeHasPrefix?prefixId=` + prefixId + '&nodeId=' + nodeId,
    method: 'get',
  })
}

export function getRecentHearts(nodeId) {
  return request({
    url: '/node/getRecentHearts/' + nodeId,
    method: 'get',
  })
}

export function getCurrentNode() {
  return request({
    url: '/node/getCurrentNode',
    method: 'get',
  })
}

export function getCurrentNodeInfo() {
  return request({
    url: '/node/getCurrentNode',
    method: 'get'
  })
}

export function getNextNodeCount() {
  return request({
    url: '/node/getNextNodeCount',
    method: 'get'
  })
}

export function joinInMonitor(nodeId) {
  return request({
    url: '/node/joinInMonitor/' + nodeId,
    method: 'post'
  })
}

export function excludeMonitor(nodeId) {
  return request({
    url: '/node/excludeMonitor/' + nodeId,
    method: 'post'
  })
}

export function chooseVirtualNode(nodeId) {
  return request({
    url: `/node/chooseVirtualNode?nodeId=${nodeId}`,
    method: 'get'
  })
}

export function getSelectedVirtualNodeId() {
  return request({
    url: `/node/getSelectedVirtualNodeId`,
    method: 'get'
  })
}